package cn.sc.summer.sms.enums;

import cn.hutool.core.util.StrUtil;
import cn.sc.summer.sms.service.impl.TencentSmsImpl;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 枚举类型：聚合短信下发平台枚举类
 *
 * @author a-xin
 * @date 2023/12/15 16:01
 */
@Getter
@AllArgsConstructor
@SuppressWarnings("all")
public enum SmsServerEnum {

    TENCENT("1", "tencent", TencentSmsImpl.class),
    A_LI("2", "ali", TencentSmsImpl.class);

    private String type;
    private String info;
    private Class<?> clazz;

    public static SmsServerEnum getByType(String type) {
        if (StrUtil.isBlank(type)) {
            return null;
        }
        for (SmsServerEnum enums : SmsServerEnum.values()) {
            if (enums.type.equals(type)) {
                return enums;
            }
        }
        return null;
    }

    public static SmsServerEnum getByInfo(String info) {
        if (StrUtil.isBlank(info)) {
            return null;
        }
        for (SmsServerEnum enums : SmsServerEnum.values()) {
            if (enums.info.equals(info)) {
                return enums;
            }
        }
        return null;
    }

}
